package acm.pta3;

import java.util.*;

public class T3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] chars = scanner.nextLine().toCharArray();
        TreeMap<Character,Integer> arr=new TreeMap<>((o1, o2) -> o2-o1);
        for (char c : chars) {
            arr.put(c,0);
        }
        int i=0;
        for (Map.Entry<Character, Integer> o : arr.entrySet()) {
            o.setValue(i++);
        }
        int[] index=new int[chars.length];
        for (int j = 0; j < chars.length; j++) {
            index[j]=arr.get(chars[j]);
        }
        StringBuilder arrStr=new StringBuilder("int[] arr = new int[]{");
        for (Character c : arr.keySet()) {
            arrStr.append(c).append(",");
        }
        System.out.println(arrStr.substring(0,arrStr.length()-1)+"};");
        StringBuilder indexStr=new StringBuilder("int[] index = new int[]{");
        for (int n : index) {
            indexStr.append(n).append(",");
        }
        System.out.println(indexStr.substring(0,indexStr.length()-1)+"};");
    }
}
